<template>
  <div>
    <top-nav/>
    <div class="container" v-loading="loading">
      <div v-for="(item,index) in list" :key="index" class="item">
        <div class="item_title">{{ item.title }}</div>
        <span class="item_time">{{ item.dataTime }}</span>
        <div class="item_cont">{{ item.subtitle }}</div>
      </div>
      <div v-if="list.length == 0" class="not-data">暂无数据</div>
    </div>
  </div>
</template>
<script>
import topNav from '@/components/topNav'
import request from 'axios';
export default {
  name: 'log',
  components: { topNav },
  data() {
    return {
      list: [],
      loading: false
    }
  },
  mounted() {
    this.init()
  },
  methods: {
    init() {
      this.loading = true
      request.get(`${process.env.VUE_APP_CODE_URL}/json/blogs.json`).then(res => {
        this.list = res.data.data
        this.loading = false
      })
    }
  },
}
</script>
<style lang="scss" scoped>
.container{
  max-width: 1200px;
  background: #fff;
  margin: 0 auto;
  padding: 15px;
  box-sizing: border-box;
  .item{
    padding: 15px 0 20px;
    margin-bottom: 15px;
    box-shadow: 0px 1px 1px -1px rgba(0,0,0,0.5);
    &_title{
      font-weight: 600;
      font-size: 15px;
    }
    &_time{
      font-size: 14px;
      color: #a6a6a6;
      margin: 7px 0 10px;
      display: block;
    }
    &_cont{
      line-height: 1.6;
    }
  }
  .not-data{
    height: 50px;
    text-align: center;
    line-height: 50px;
  }
}
</style>